From: Phil Elwell Date: Fri, 13 Mar 2015 12:43:36 +0000 (+0000) Subject: Protect __release_resource against resources without parents X-Git-Tag: archive/raspbian/4.9.13-1+rpi1~8^2~196 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=d3078bd3040aa01758d08993ddc73fc374c5a828;p=linux-4.9.git Protect __release_resource against resources without parents Without this patch, removing a device tree overlay can crash here. Signed-off-by: Phil Elwell --- diff --git a/kernel/resource.c b/kernel/resource.c index 9b5f04404152..f8a9af6e6b91 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -246,6 +246,12 @@ static int __release_resource(struct resource *old, bool release_child) { struct resource *tmp, **p, *chd; + if (!old->parent) { + WARN(old->sibling, "sibling but no parent"); + if (old->sibling) + return -EINVAL; + return 0; + } p = &old->parent->child; for (;;) { tmp = *p;